<script type="text/javascript" src="{$TMPL}/js/jscharts_cr.js"></script>
{if $deal_list}
<div class="i_deal_list clearfix pr15 pl15">
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tbody>
            <tr border="0" style="background-color:#00bef0; color:#fff; height:34px;">
                <th >借款标题</th>
                <th style="width:12%">金额</th>
                <th style="width:10%">年利率</th>
                <th style="width:10%">期限</th>
                <th style="width:10%">完成度</th>
                <th style="width:15%">发布日期</th>
                <th style="width:12%">状态</th> 
            </tr>
            {foreach from=$deal_list item="deal" key=key name="deal"}
            <tr class="item {if $key mod 2 eq 1}item_1{/if}" {if $smarty.foreach.deal.last}style="border-bottom:0"{/if}>
                <td align="left" >
                	<div class="pl10">
                    <a href=" {if $deal.is_delete eq 2 || $deal.is_delete eq 3}{url x="index" r="borrow#stepone"}{else}{$deal.url}{/if}">{$deal.name}</a>
					</div>
                </td>
                <td>
                    {$deal.borrow_amount_format}
                </td>
                <td>
                    {function name="number_format" v="$deal.rate" f="2"}%
                </td>
                <td>
                    {$deal.repay_time}{if $deal.repay_time_type eq 0}天{else}个月{/if}
                </td>
                <td>
                    <div class="graph-box">
                        <p>
                            {if  $deal.deal_status eq 5}
                            100%
                            {elseif $deal.deal_status eq 4}
                            {function name='round' v='$deal.repay_progress_point' f=0}%
                            {else}
                            {function name="round" v=$deal.progress_point f=0}%
                            {/if}
                        </p>
                        <div id="graph-{$deal.id}"></div>
                    </div>
                    <script type="text/javascript">
                        {if  $deal.deal_status eq 5}
                        <!--//已还清-->
                        var colors = ['#00bef0', '#e7e5e5'];
                        var myData = new Array(['OK', 100], ['NO', 0]);
                        {elseif $deal.deal_status eq 4}
                        <!--//还款中-->
                        var colors = ['#00bef0', '#e7e5e5'];
                        var myData = new Array([' ', {function name='round' val=$deal.repay_progress_point f=2}], [' ', <?php echo 100-round($this->_var['deal']['repay_progress_point'],2) ?>]);
                        {else}
                        <!--//筹款中-->
                        var colors = ['#00bef0', '#e7e5e5'];
                        var myData = new Array([' ', {function name='round' val=$deal.progress_point f=2}], [' ', <?php echo 100-round($this->_var['deal']['progress_point'],2) ?>]);
                        {/if}
                        var myChart = new JSChart('graph-{$deal.id}', 'pie');
                        myChart.setDataArray(myData);
                        myChart.colorizePie(colors);
                        myChart.setTitleColor('#8E8E8E');
                        myChart.setTitleFontSize(0);
                        myChart.setTextPaddingTop(280);
                        myChart.setPieValuesDecimals(1);
                        myChart.setPieUnitsFontSize(0);
                        if($.browser.msie)
                            myChart.setPieValuesFontSize(0);
                        else
                            myChart.setPieValuesFontSize(100000000);
                        myChart.setPieValuesColor('#fff');
                        myChart.setPieUnitsColor('#969696');
                        myChart.setSize(46, 46);
                        myChart.setPiePosition(0, 0);
                        myChart.setPieRadius(23);
                        myChart.setFlagColor('#1BB8E3');
                        myChart.setFlagRadius(4);
                        myChart.setTooltipOpacity(1);
                        myChart.setTooltipBackground('#ddf');
                        myChart.setTooltipPosition('ne');
                        myChart.setTooltipOffset(2);
                        myChart.draw();
                    </script>
                </td>
                <td>
                    {if $deal.publish_wait eq 1 || $deal.publish_wait eq 0}
                    <div class="tc">
                        {function name="to_date" v="$deal.create_time" f="Y-m-d"}
                    </div>
                    <div class="tc">
                         {function name="to_date" v="$deal.create_time" f="H:i"}
                    </div>
                    {else}
                    <div class="tc">
                        {function name="to_date" v="$deal.start_time" f="Y-m-d"}
                    </div>
                    <div class="tc">
                         {function name="to_date" v="$deal.start_time" f="H:i"}
                    </div>
                    {/if}
                </td>
                <td>
                   
                    {if $deal.is_delete eq 2}
					<a href="{url x="index" r="borrow#stepone"}" class="f_blue">草稿</a>
					{elseif $deal.is_delete eq 3}
					<a href="{url x="index" r="borrow#stepone"}" class="f_blue">审核失败</a>
                    {elseif $deal.publish_wait eq 1}
					<a href="{url x="index" r="borrow#stepone"}" class="f_blue">等待审核</a>
                    {else}
                        {if $deal.deal_status eq 5}
						<span class="f_white f_green">还款完毕</span>
                        {elseif $deal.deal_status eq 0}
						<span class="f_white">等待材料</span>
                        {elseif $deal.deal_status eq 2}
						<span class="f_white f_orange">满标</span>
                        {elseif $deal.deal_status eq 4}
						<span class="f_white f_green">还款中</span>
                        {elseif $deal.deal_status eq 1 && $deal.remain_time gt 0}
						<span class="f_white">筹款中</span>
                        {elseif $deal.deal_status eq 3 || $deal.remain_time lte 0}
						<span class="f_white f_gray">流标</span>
                        {/if}
                    {/if}
                    </span>
                </td>
            </tr>
            {/foreach}
        </tbody>
    </table>
    <div class="pages">{$pages}</div>
</div>
{else}
<div class="tc p15">暂无记录</div>
{/if}
<script type="text/javascript">
$(function(){
    var p_width=$(".i_deal_list p").width();
    var box_width=$(".i_deal_list .graph-box").width();
    var left_w=(box_width/2)-(p_width/2);
    $(".i_deal_list p").css("left",left_w+"px");
})  
</script>